package com.srv.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;

import com.srv.util.ObjectField;
/**
 * 游记节点类.
 * @author Administrator
 *
 */
public class Node extends TheBaseObj {
	public final static Integer COLUMN_NAME_Text = Integer.valueOf(100);
	public final static Integer COLUMN_NAME_Lat = Integer.valueOf(101);
	public final static Integer COLUMN_NAME_Long = Integer.valueOf(102);
	public final static Integer COLUMN_NAME_Img = Integer.valueOf(103);
	public final static Integer COLUMN_NAME_Record = Integer.valueOf(104);
	
	private static final String SPLIT_FLAG = "|@|";
	
	public String nodeID = null;
	
	public String travelID = null;
	/**
	 * 收藏次数
	 */
    public long favorNum = 0;
    /**
	 * 下载次数
	 */
    public long downloadNum = 0;
    /**
	 * 转发次数
	 */
    public long rePubNum = 0;
    

    /**
     * 图片URI(对外公开)
     */
    public String img_public_URI = null;
    
    /**
     * 录音URI(对外公开)
     */
    public String record_public_URI = null;
    
    /**
     * 图片URI
     */
    public List<String> img_Inner_URI = null;
    /**
     * 录音URI
     */
    public List<String> record_Inner_URI = null;    
    /**
     * 文本描述
     */
    public String textContext = null;
    /**
     * 标签
     */
    public String tag =null;
    /**
     * 经度.
     */
    public double longitude=0;
    /**
     * 维度.
     */
    public double latitude=0;
    
    public static String listToString(List<String> list){
    	if(list == null || list.size() < 1){
    		return null;
    	}
    	
    	StringBuilder buf = new StringBuilder();
    	for(String str : list){
    		buf.append(str);
    		buf.append(SPLIT_FLAG);
    	}
    	buf.delete(buf.length() - 3, buf.length());
    	
    	return buf.toString();
    }
    
    public static List<String> stringToList(String str){
    	if(str == null){
    		return null;
    	}
    	
    	String[] strArray = str.split("\\|@\\|");
    	List<String> list = new ArrayList<String>();
    	for (int i = 0; i < strArray.length; i++) {
			list.add(strArray[i]);
		}
    	
    	return list;
    }
    
    public String getImgInnerURI(){
    	return Node.listToString(this.img_Inner_URI);
    }
    
    public void setImgInnerURI(String listStr){
    	this.img_Inner_URI = Node.stringToList(listStr);
    }
    
    public String getRecordInnerURI(){
    	return Node.listToString(this.record_Inner_URI);
    }
    
    public void setRecordInnerURI(String listStr){
    	this.record_Inner_URI = Node.stringToList(listStr);
    }
    
}
